/**
 *
 * @author Alex
 */
public class Node {

    private Integer element;
    private Node next;

    //post: has constructed a Node object with element = el and next = nx
    public Node(Integer el, Node nx){
        element = el;
        next = nx;
    }

    //post: element = el
    public void setElement(Integer el){
        element = el;
    }

    //post next = nx
    public void setNext(Node nx){
        next = nx;
    }

    //post: returns element
    public Integer getElement(){
        return element;
    }

    //post: returns next
    public Node getNext(){
        return next;
    }

    //post: returns true iff other is a Node object that contains an
    //Integer that equals the Integer of this
    @Override
    public boolean equals(Object other){
        if(other instanceof Node){
            Node that = (Node)other;
            return this.getElement().compareTo(that.getElement()) == 0;
        }
        else return false;
    }

    //post: returns a String representation of Node
    @Override
    public String toString(){
         return "<Node(" + element + ")>";
    }
}